package com.helloniu.wb.containers {

import com.helloniu.fl.util.*;
import com.helloniu.wb.tools.*;

public class ShapeTypeDef {

    public function ShapeTypeDef() {
        // init for Class2. new instance        
    }

    public static function getShapeClassName(shapeType:Number):String {
        var className:String = null;

        if(shapeType == LINE) {
            new LineTool();
            className = "com.helloniu.wb.tools.LineTool";
        }
        else if(shapeType == PENCILE) {
            new PencileTool();
            className = "com.helloniu.wb.tools.PencileTool";
        }
        else if(shapeType == RECT) {
            new RectangleTool();
            className = "com.helloniu.wb.tools.RectangleTool";
        }
        else if(shapeType == RRECT) {
            new RRectangleTool();
            className = "com.helloniu.wb.tools.RRectangleTool";
        }
        else if(shapeType == ELLIPSE) {
            new EllipseTool();
            className = "com.helloniu.wb.tools.EllipseTool";
        }
        else if(shapeType == TEXT) {
            new TextTool();
            className = "com.helloniu.wb.tools.TextTool";
        }
        else if(shapeType == LASER) {
            new LaserPenTool();
            className = "com.helloniu.wb.tools.LaserPenTool";
        }
        else {
            Tool.alert("getShapeClassName: " + shapeType);
        }

        return className;
    }
    
    public static function getShapeClass(shapeType:Number):Class {
        var clazz:Class = null;

        if(shapeType == LINE) {
            clazz = com.helloniu.wb.tools.LineTool;
        }
        else if(shapeType == PENCILE) {
            clazz = com.helloniu.wb.tools.PencileTool;
        }
        else if(shapeType == RECT) {
            clazz = com.helloniu.wb.tools.RectangleTool;
        }
        else if(shapeType == RRECT) {
            clazz = com.helloniu.wb.tools.RRectangleTool;
        }
        else if(shapeType == ELLIPSE) {
            clazz = com.helloniu.wb.tools.EllipseTool;
        }
        else if(shapeType == TEXT) {
            clazz = com.helloniu.wb.tools.TextTool;
        }
        else if(shapeType == LASER) {
            clazz = com.helloniu.wb.tools.LaserPenTool;
        }
        else {
            Tool.alert("getShapeClass: " + shapeType);
        }

        return clazz;
    }
    
    public static function isValid2(shapeType:int):Boolean {
		if(shapeType == LINE || shapeType == PENCILE ||
			shapeType == RECT || shapeType == RRECT || shapeType == ELLIPSE || 
			shapeType == TEXT || shapeType == LASER) 
	    {
			return true;
		}
		
		Tool.alert("---error shapetype found----");
		return false;		
	}

    public static const LINE:Number = 0X10;
    public static const PENCILE:Number = 0X15;
    public static const RECT:Number = 0X20;
    public static const RRECT:Number = 0X21;
    public static const ELLIPSE:Number = 0X22;
    public static const TEXT:Number = 0X30;
    public static const LASER:Number = 0X40;

    }
}